package com.xuanwei.core.annos;

import com.xuanwei.core.validate.ContainValidate;
import com.xuanwei.core.validate.PositiveValidate;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @Author jiangyong
 * @Description 校验数字是否为正整数
 * @Date 2019/8/15 11:20
 **/
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = {PositiveValidate.class})
public @interface Positive {

    String message() default "the number is not position integer";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    boolean containZero() default false;
}
